/*
 * @(#)DihedralAngleList.java
 *
 * Copyright 2004 Actelion Ltd., Inc. All Rights Reserved.
 *
 * This software is the proprietary information of Actelion Pharmaceuticals, Ltd.
 * Use is subject to license terms.
 *
 * @author Thomas Sander
 */

package com.actelion.research.chem.conf;

import java.util.TreeMap;

import com.actelion.research.chem.ExtendedMolecule;
import com.actelion.research.chem.Molecule;
import com.actelion.research.chem.RingCollection;

public class DihedralAngleKnowledgeBase {
    private static DihedralAngleKnowledgeBase sTheKnowledgeBase;
    private TreeMap<String, int[]> mTreeMap;

    public static DihedralAngleKnowledgeBase getKnowledgeBase() {
        if (sTheKnowledgeBase == null)
            sTheKnowledgeBase = new DihedralAngleKnowledgeBase();
    	
        return sTheKnowledgeBase;
    	}

    public int[] getDihedralAngles(ExtendedMolecule mol, int bond, int connIndex1, int connIndex2) {
        String type = getDihedralAngleType(mol, bond, connIndex1, connIndex2);
        return (type == null) ? null : mTreeMap.get(type);
    	}
    
	public static String getDihedralAngleType(ExtendedMolecule mol, int bond, int connIndex1, int connIndex2) {
	    	// call ensureHelperArrays(Molecule.cHelperRings)
	    	// connIndex1 is connAtom index for atom connected to bondAtom[bond][0]
	    	// connIndex2 is connAtom index for atom connected to bondAtom[bond][1]

		if (mol.isAromaticBond(bond) || mol.getBondOrder(bond) != 1)
		    return null;

	    int atom1 = mol.getBondAtom(0, bond);
	    int atom2 = mol.getBondAtom(1, bond);
		int conn1 = mol.getConnAtom(atom1, connIndex1);
		int conn2 = mol.getConnAtom(atom2, connIndex2);
		int bond1 = mol.getConnBond(atom1, connIndex1);
		int bond2 = mol.getConnBond(atom2, connIndex2);
		if (mol.getBondOrder(bond1) != 1
		 || mol.isAromaticBond(bond1)
		 || mol.getBondOrder(bond2) != 1
		 || mol.isAromaticBond(bond2))
			return null;

			// bonds of rings slammer than 6 members are not supported
		RingCollection ringSet = mol.getRingSet();
		for (int ring=0; ring<ringSet.getSize(); ring++) {
		    if (ringSet.getRingSize(ring) < 6) {
		        int[] ringBond = ringSet.getRingBonds(ring);
		        for (int i=0; i<ringBond.length; i++)
		            if (ringBond[i] == bond)
		                return null;
			    }
			}
		
	    String s0 = mol.isSmallRingBond(bond) ? "r" : "";

	    String s1 = getHalfDihedralAngleType(mol, atom1, conn1, atom2);
		if (s1 == null)
		    return null;

		String s2 = getHalfDihedralAngleType(mol, atom2, conn2, atom1);
		if (s2 == null)
		    return null;

		return (s1.compareTo(s2)>0) ? s0+s2+s1 : s0+s1+s2;
		}

	private static String getHalfDihedralAngleType(ExtendedMolecule mol, int atom, int conn1, int conn2) {
	    int atomicNo1 = mol.getAtomicNo(atom);
	    if (atomicNo1 != 6
	     && atomicNo1 != 7
	     && atomicNo1 != 8
	     && atomicNo1 != 15
	     && atomicNo1 != 16)
			return null;

	    int atomicNo2 = mol.getAtomicNo(conn1);
		if (atomicNo2 != 6
		 && atomicNo2 != 7
		 && atomicNo2 != 8
		 && atomicNo2 != 9
		 && atomicNo2 != 15
		 && atomicNo2 != 16
		 && atomicNo2 != 17
		 && atomicNo2 != 35
		 && atomicNo2 != 53)
			return null;

		char atomSubstitution = '.';	// default: no further atoms
	    if (mol.getConnAtoms(atom) > 2) {
		    for (int i=0; i<mol.getConnAtoms(atom); i++) {
		        int conn = mol.getConnAtom(atom, i);
		        if (conn != conn1 && conn != conn2)
	            	atomSubstitution = (mol.getConnBondOrder(atom, i) == 1) ? '-'
	            					 : (mol.isElectronegative(conn)) ? '=' : ':';
		        }
		    }

		return Molecule.cAtomLabel[atomicNo1] + atomSubstitution
	    	 + Molecule.cAtomLabel[atomicNo2];
	    }

    private DihedralAngleKnowledgeBase() {
        String[] typeList = getDihedralTypeList();
        int[][] angleList = getDihedralAngleList();
        mTreeMap = new TreeMap<String, int[]>();
        for (int i=0; i<typeList.length; i++)
            mTreeMap.put(typeList[i], angleList[i]);
    	}

	private static final String[] getDihedralTypeList() {
		String[] type = {
				"C-BrC-Br",	"C-BrC-C",	"C-BrC-Cl",	"C-BrC-F",	"C-BrC-N",	"C-BrC-O",
				"C-BrC.Br",	"C-BrC.C",	"C-BrC.O",	"C-BrC:C",	"C-BrC=C",	"C-BrC=N",
				"C-BrC=O",	"C-BrN=O",	"C-BrP-C",	"C-BrS=C",	"C-CC-C",	"C-CC-Cl",
				"C-CC-F",	"C-CC-I",	"C-CC-N",	"C-CC-O",	"C-CC-P",	"C-CC-S",
				"C-CC.Br",	"C-CC.C",	"C-CC.Cl",	"C-CC.F",	"C-CC.I",	"C-CC.N",
				"C-CC.O",	"C-CC.P",	"C-CC.S",	"C-CC:C",	"C-CC:Cl",	"C-CC:N",
				"C-CC:O",	"C-CC:P",	"C-CC:S",	"C-CC=C",	"C-CC=Cl",	"C-CC=N",
				"C-CC=O",	"C-CC=P",	"C-CC=S",	"C-CN-Br",	"C-CN-C",	"C-CN-F",
				"C-CN-N",	"C-CN-O",	"C-CN-P",	"C-CN-S",	"C-CN.C",	"C-CN.N",
				"C-CN.O",	"C-CN.P",	"C-CN.S",	"C-CN:C",	"C-CN:O",	"C-CN=C",
				"C-CN=N",	"C-CN=O",	"C-CO.C",	"C-CO.Cl",	"C-CO.N",	"C-CO.O",
				"C-CO.P",	"C-CO.S",	"C-CP-Br",	"C-CP-C",	"C-CP-Cl",	"C-CP-F",
				"C-CP-I",	"C-CP-N",	"C-CP-O",	"C-CP-P",	"C-CP-S",	"C-CP:C",
				"C-CP=C",	"C-CP=Cl",	"C-CP=N",	"C-CP=O",	"C-CP=P",	"C-CP=S",
				"C-CS-C",	"C-CS-F",	"C-CS-N",	"C-CS-O",	"C-CS.C",	"C-CS.N",
				"C-CS.P",	"C-CS.S",	"C-CS=C",	"C-CS=N",	"C-CS=O",	"C-CS=S",
				"C-ClC-Cl",	"C-ClC-F",	"C-ClC-N",	"C-ClC-O",	"C-ClC-P",	"C-ClC-S",
				"C-ClC.C",	"C-ClC.Cl",	"C-ClC.O",	"C-ClC:C",	"C-ClC:Cl",	"C-ClC=C",
				"C-ClC=N",	"C-ClC=O",	"C-ClN-C",	"C-ClN=O",	"C-ClO.C",	"C-ClP-C",
				"C-ClP-Cl",	"C-ClP-F",	"C-ClP-N",	"C-ClP-O",	"C-ClP=O",	"C-ClS.N",
				"C-ClS.S",	"C-ClS=C",	"C-FC-F",	"C-FC-I",	"C-FC-N",	"C-FC-O",
				"C-FC-P",	"C-FC-S",	"C-FC.C",	"C-FC.N",	"C-FC.O",	"C-FC.S",
				"C-FC:C",	"C-FC:Cl",	"C-FC:F",	"C-FC:N",	"C-FC:O",	"C-FC:P",
				"C-FC:S",	"C-FC=C",	"C-FC=N",	"C-FC=O",	"C-FC=S",	"C-FN-C",
				"C-FN-O",	"C-FN-S",	"C-FN=O",	"C-FO.C",	"C-FP-C",	"C-FP-F",
				"C-FP-N",	"C-FP-O",	"C-FP-P",	"C-FP=C",	"C-FS-F",	"C-FS-N",
				"C-FS.C",	"C-FS.S",	"C-FS=C",	"C-FS=N",	"C-FS=O",	"C-IC-O",
				"C-IC.C",	"C-NC-N",	"C-NC-O",	"C-NC-S",	"C-NC.Br",	"C-NC.C",
				"C-NC.I",	"C-NC.N",	"C-NC.O",	"C-NC.S",	"C-NC:C",	"C-NC=C",
				"C-NC=N",	"C-NC=O",	"C-NC=S",	"C-NN-C",	"C-NN.C",	"C-NN.N",
				"C-NN=C",	"C-NN=O",	"C-NO.C",	"C-NO.N",	"C-NO.O",	"C-NP-C",
				"C-NP-N",	"C-NP-O",	"C-NP=O",	"C-NS.C",	"C-NS.S",	"C-NS=C",
				"C-NS=O",	"C-OC-O",	"C-OC-P",	"C-OC-S",	"C-OC.Br",	"C-OC.C",
				"C-OC.Cl",	"C-OC.F",	"C-OC.I",	"C-OC.N",	"C-OC.O",	"C-OC.P",
				"C-OC.S",	"C-OC:Br",	"C-OC:C",	"C-OC:N",	"C-OC:O",	"C-OC:S",
				"C-OC=C",	"C-OC=N",	"C-OC=O",	"C-OC=S",	"C-ON-C",	"C-ON-N",
				"C-ON-O",	"C-ON.C",	"C-ON=O",	"C-OO.C",	"C-OO.N",	"C-OO.O",
				"C-OP-C",	"C-OP-O",	"C-OP=O",	"C-OS.C",	"C-OS=C",	"C-PC-P",
				"C-PC.C",	"C-PC.O",	"C-PC=C",	"C-PC=O",	"C-PN-C",	"C-PN.C",
				"C-PO.C",	"C-PP-C",	"C-PP-O",	"C-PP=O",	"C-SC-S",	"C-SC.C",
				"C-SC.Cl",	"C-SC.N",	"C-SC.O",	"C-SC.S",	"C-SC:C",	"C-SC=C",
				"C-SC=N",	"C-SC=O",	"C-SN-C",	"C-SN.C",	"C-SO.C",	"C-SP-C",
				"C-SP-O",	"C-SS-F",	"C-SS.C",	"C-SS.S",	"C-SS=C",	"C.BrC.C",
				"C.BrC.O",	"C.BrC:C",	"C.BrC=C",	"C.BrC=N",	"C.BrC=O",	"C.CC.C",
				"C.CC.Cl",	"C.CC.N",	"C.CC.O",	"C.CC.P",	"C.CC.S",	"C.CC:Br",
				"C.CC:C",	"C.CC:N",	"C.CC:O",	"C.CC:S",	"C.CC=C",	"C.CC=N",
				"C.CC=O",	"C.CC=S",	"C.CN-C",	"C.CN-N",	"C.CN-O",	"C.CN-P",
				"C.CN-S",	"C.CN.C",	"C.CN.N",	"C.CN.P",	"C.CN.S",	"C.CN:C",
				"C.CN=O",	"C.CO.C",	"C.CO.N",	"C.CO.O",	"C.CO.P",	"C.CO.S",
				"C.CP-C",	"C.CP-N",	"C.CP-O",	"C.CP:C",	"C.CP=C",	"C.CP=O",
				"C.CS-C",	"C.CS-F",	"C.CS-I",	"C.CS-O",	"C.CS.C",	"C.CS.P",
				"C.CS.S",	"C.CS=C",	"C.CS=N",	"C.CS=O",	"C.ClC.Cl",	"C.ClC.N",
				"C.ClC.O",	"C.ClC:C",	"C.ClC=C",	"C.ClC=N",	"C.ClC=O",	"C.ClN-C",
				"C.ClP-C",	"C.ClP-N",	"C.IC=O",	"C.IP-C",	"C.NC.N",	"C.NC.O",
				"C.NC.P",	"C.NC.S",	"C.NC:C",	"C.NC=C",	"C.NC=N",	"C.NC=O",
				"C.NN-C",	"C.NN-N",	"C.NN-S",	"C.NN.C",	"C.NO.C",	"C.NO.O",
				"C.NP-C",	"C.NP-O",	"C.NP=C",	"C.NP=O",	"C.OC.O",	"C.OC.P",
				"C.OC.S",	"C.OC:C",	"C.OC:N",	"C.OC:O",	"C.OC:S",	"C.OC=C",
				"C.OC=N",	"C.OC=O",	"C.ON-C",	"C.ON-N",	"C.ON-S",	"C.OO.C",
				"C.OO.N",	"C.OP-C",	"C.OP-O",	"C.PC.P",	"C.PC:C",	"C.PC=C",
				"C.PC=O",	"C.PN-C",	"C.PN.C",	"C.PO.C",	"C.PP-C",	"C.SC.S",
				"C.SC:C",	"C.SC=C",	"C.SC=N",	"C.SC=O",	"C.SN-C",	"C.SS.C",
				"C.SS=C",	"C:CC:C",	"C:CC:N",	"C:CC:O",	"C:CC=C",	"C:CC=N",
				"C:CC=O",	"C:CC=S",	"C:CN-C",	"C:CN.C",	"C:CN.N",	"C:CN=O",
				"C:CO.C",	"C:CO.P",	"C:CO.S",	"C:CP-C",	"C:CP-N",	"C:CP-O",
				"C:CP=O",	"C:CS-C",	"C:CS-F",	"C:CS.C",	"C:CS.S",	"C:CS=C",
				"C:ClC=O",	"C:ClN-C",	"C:FC:F",	"C:NC:N",	"C:NC=C",	"C:NC=N",
				"C:NC=O",	"C:NN-C",	"C:NN.C",	"C:NN=O",	"C:NO.C",	"C:NP-O",
				"C:NS.C",	"C:NS.S",	"C:OC:O",	"C:OC=C",	"C:OC=O",	"C:ON-C",
				"C:OO.C",	"C:OS.C",	"C:PC:P",	"C:PC=O",	"C:PP-C",	"C:SC=C",
				"C:SC=N",	"C:SC=O",	"C:SC=S",	"C:SN-C",	"C:SN.C",	"C:SO.C",
				"C:SS.C",	"C:SS.S",	"C:SS=C",	"C=CC=C",	"C=CC=N",	"C=CC=O",
				"C=CC=S",	"C=CN-C",	"C=CN-N",	"C=CN-O",	"C=CN-S",	"C=CN.C",
				"C=CN.N",	"C=CN.O",	"C=CN.P",	"C=CN.S",	"C=CO.C",	"C=CO.I",
				"C=CO.N",	"C=CO.O",	"C=CP-C",	"C=CP-N",	"C=CP-O",	"C=CP-P",
				"C=CP=O",	"C=CS.C",	"C=CS.P",	"C=CS.S",	"C=CS=C",	"C=ClN-C",
				"C=NC=N",	"C=NC=O",	"C=NC=S",	"C=NN-C",	"C=NN-N",	"C=NN-O",
				"C=NN-P",	"C=NN.C",	"C=NN.N",	"C=NN.P",	"C=NN.S",	"C=NO.C",
				"C=NO.N",	"C=NP-C",	"C=NP-O",	"C=NS.C",	"C=NS.P",	"C=NS.S",
				"C=OC=O",	"C=ON-C",	"C=ON-N",	"C=ON-S",	"C=ON.C",	"C=ON.N",
				"C=OO.C",	"C=OS.C",	"C=PN-C",	"C=PN.C",	"C=PP-C",	"C=PS.C",
				"C=SC=S",	"C=SN-C",	"C=SN.C",	"C=SN.N",	"C=SO.C",	"C=SP-C",
				"C=SP-N",	"C=SS.C",	"C=SS.S",	"C=SS=C",	"N-CN-C",	"N-CN-P",
				"N-CN-S",	"N-CN.C",	"N-CN.N",	"N-CN=O",	"N-CO.C",	"N-CO.S",
				"N-CP-C",	"N-CP-Cl",	"N-CP-F",	"N-CP-I",	"N-CP-N",	"N-CP-O",
				"N-CP-P",	"N-CP-S",	"N-CP:C",	"N-CP:Cl",	"N-CP:F",	"N-CP:N",
				"N-CP=C",	"N-CP=Cl",	"N-CP=N",	"N-CP=O",	"N-CS-C",	"N-CS-N",
				"N-CS.C",	"N-CS.N",	"N-CS.S",	"N-CS=C",	"N-CS=N",	"N-CS=O",
				"N-NP-C",	"N-NP-Cl",	"N-NP-N",	"N-NP-O",	"N-NP=Cl",	"N-NS=C",
				"N-OP-C",	"N-OS=C",	"N-PN=O",	"N-PP-C",	"N-PP-Cl",	"N-PP-F",
				"N-PP-N",	"N-PP-O",	"N-PP=N",	"N-PS=C",	"N-SP-C",	"N-SS.C",
				"N-SS.N",	"N-SS.S",	"N-SS=C",	"N.CN.C",	"N.CN=O",	"N.CO.C",
				"N.CP-C",	"N.CP-Cl",	"N.CP-N",	"N.CP-O",	"N.CP=C",	"N.CP=Cl",
				"N.CP=N",	"N.CP=O",	"N.CS-C",	"N.CS-F",	"N.CS.C",	"N.CS=C",
				"N.CS=N",	"N.NN=O",	"N.NP-C",	"N.NP-N",	"N.NP-O",	"N.NS=C",
				"N.PP-C",	"N.PP-O",	"N.PP=O",	"N.SS-C",	"N.SS-N",	"N.SS=C",
				"N:CP-N",	"N=OO.C",	"O.CO.C",	"O.CP-C",	"O.CP-Cl",	"O.CP-I",
				"O.CP-N",	"O.CP-O",	"O.CP-S",	"O.CP=C",	"O.CP=Cl",	"O.CP=N",
				"O.CP=O",	"O.CP=S",	"O.CS-C",	"O.CS=C",	"O.CS=N",	"O.CS=O",
				"O.NS=C",	"O.PP-C",	"O.PP-N",	"O.PP-O",	"O.PP=O",	"P-CP-C",
				"P-CP-N",	"P-CP-P",	"P-CP=C",	"P-CS.C",	"P-CS.P",	"P-CS.S",
				"P-NP-N",	"P-NP-P",	"P-NS.C",	"P-OP-P",	"P-OS.C",	"P-OS.P",
				"P-OS.S",	"P-PP-P",	"P-SS.C",	"P-SS.P",	"P=CP=C",	"P=NS.C",
				"P=OS.C",	"P=SS.C",	"S.CS.C",	"S.CS.S",	"S.CS=C",	"S.NS.N",
				"S.NS.S",	"S.PS.P",	"S.SS.S",	"S.SS=C",	"rC-BrC-Br","rC-BrC-C",
				"rC-BrC-Cl","rC-BrC-N",	"rC-BrC-O",	"rC-BrC.C",	"rC-BrC.N",	"rC-BrC.O",
				"rC-BrC:C",	"rC-BrC=C",	"rC-BrC=N",	"rC-CC-C",	"rC-CC-Cl",	"rC-CC-F",
				"rC-CC-I",	"rC-CC-N",	"rC-CC-O",	"rC-CC-P",	"rC-CC-S",	"rC-CC.C",
				"rC-CC.N",	"rC-CC.O",	"rC-CC.P",	"rC-CC.S",	"rC-CC:Br",	"rC-CC:C",
				"rC-CC:Cl",	"rC-CC:F",	"rC-CC:N",	"rC-CC:O",	"rC-CC:P",	"rC-CC:S",
				"rC-CC=C",	"rC-CC=N",	"rC-CC=O",	"rC-CC=S",	"rC-CN-C",	"rC-CN-N",
				"rC-CN-O",	"rC-CN-P",	"rC-CN-S",	"rC-CN.C",	"rC-CN.N",	"rC-CN.P",
				"rC-CN.S",	"rC-CN:C",	"rC-CN:O",	"rC-CN=C",	"rC-CO.C",	"rC-CO.N",
				"rC-CO.O",	"rC-CO.P",	"rC-CO.S",	"rC-CP-C",	"rC-CP-O",	"rC-CP-P",
				"rC-CP.C",	"rC-CP=C",	"rC-CP=O",	"rC-CS-C",	"rC-CS-O",	"rC-CS.C",
				"rC-CS.S",	"rC-CS=C",	"rC-CS=N",	"rC-CS=O",	"rC-ClC-Cl","rC-ClC-F",
				"rC-ClC-N",	"rC-ClC-O",	"rC-ClC-S",	"rC-ClC.C",	"rC-ClC.N",	"rC-ClC.O",
				"rC-ClC:C",	"rC-ClC:Cl","rC-ClC=C",	"rC-ClC=N",	"rC-ClC=O",	"rC-ClO.C",
				"rC-ClP-O",	"rC-ClS=C",	"rC-FC-F",	"rC-FC-N",	"rC-FC-O",	"rC-FC-S",
				"rC-FC.C",	"rC-FC.O",	"rC-FC.S",	"rC-FC:C",	"rC-FC:F",	"rC-FC=C",
				"rC-FC=N",	"rC-FN-C",	"rC-FO.C",	"rC-FP-O",	"rC-FS=C",	"rC-IC-N",
				"rC-IC-O",	"rC-IC.C",	"rC-NC-N",	"rC-NC-O",	"rC-NC-S",	"rC-NC.C",
				"rC-NC.N",	"rC-NC.O",	"rC-NC.S",	"rC-NC:Br",	"rC-NC:C",	"rC-NC:Cl",
				"rC-NC:N",	"rC-NC:O",	"rC-NC=C",	"rC-NC=N",	"rC-NC=O",	"rC-NN-C",
				"rC-NN-N",	"rC-NN-O",	"rC-NN-S",	"rC-NN.C",	"rC-NN.N",	"rC-NO.C",
				"rC-NO.N",	"rC-NS.C",	"rC-NS.S",	"rC-OC-O",	"rC-OC-P",	"rC-OC-S",
				"rC-OC.C",	"rC-OC.N",	"rC-OC.O",	"rC-OC.S",	"rC-OC:Br",	"rC-OC:C",
				"rC-OC:Cl",	"rC-OC:F",	"rC-OC:N",	"rC-OC:O",	"rC-OC:S",	"rC-OC=C",
				"rC-OC=N",	"rC-OC=O",	"rC-ON-C",	"rC-ON-N",	"rC-ON-O",	"rC-ON-S",
				"rC-ON.C",	"rC-OO.C",	"rC-OO.N",	"rC-OO.O",	"rC-OO.P",	"rC-OP-C",
				"rC-OP-O",	"rC-OP=O",	"rC-OS.C",	"rC-OS=C",	"rC-PC.C",	"rC-PC:C",
				"rC-PO.C",	"rC-PO.P",	"rC-PP-C",	"rC-PP-O",	"rC-PS.C",	"rC-SC-S",
				"rC-SC.C",	"rC-SC.N",	"rC-SC.O",	"rC-SC.S",	"rC-SC:C",	"rC-SC=C",
				"rC-SC=N",	"rC-SN-C",	"rC-SN.C",	"rC-SO.C",	"rC-SS.C",	"rC-SS.S",
				"rC-SS=C",	"rC.CC.C",	"rC.CC.N",	"rC.CC.O",	"rC.CC.P",	"rC.CC.S",
				"rC.CC:Br",	"rC.CC:C",	"rC.CC:N",	"rC.CC:O",	"rC.CC:P",	"rC.CC:S",
				"rC.CC=C",	"rC.CC=N",	"rC.CC=O",	"rC.CN-C",	"rC.CN-N",	"rC.CN-O",
				"rC.CN-P",	"rC.CN-S",	"rC.CN.C",	"rC.CN.N",	"rC.CN.P",	"rC.CN:C",
				"rC.CO.C",	"rC.CO.N",	"rC.CO.O",	"rC.CO.P",	"rC.CO.S",	"rC.CP-C",
				"rC.CP-O",	"rC.CP-P",	"rC.CP=C",	"rC.CP=O",	"rC.CS-C",	"rC.CS-O",
				"rC.CS.C",	"rC.CS.P",	"rC.CS.S",	"rC.CS=C",	"rC.CS=N",	"rC.NC.N",
				"rC.NC.O",	"rC.NC.S",	"rC.NC:C",	"rC.NC=C",	"rC.NC=N",	"rC.NN-C",
				"rC.NN-N",	"rC.NN-O",	"rC.NN-S",	"rC.NN.C",	"rC.NO.C",	"rC.NP-C",
				"rC.NS.C",	"rC.OC.O",	"rC.OC.S",	"rC.OC:C",	"rC.OC=C",	"rC.ON-C",
				"rC.ON-N",	"rC.OO.C",	"rC.OP-C",	"rC.OP-O",	"rC.PC.P",	"rC.PN-C",
				"rC.PO.C",	"rC.PP-C",	"rC.PP-N",	"rC.PP-O",	"rC.PP=O",	"rC.PS.C",
				"rC.SC.S",	"rC.SC:C",	"rC.SC:S",	"rC.SC=C",	"rC.SC=N",	"rC.SN-C",
				"rC.SS.C",	"rC.SS=C",	"rC:BrC:C",	"rC:BrC=C",	"rC:BrC=N",	"rC:CC:C",
				"rC:CC:Cl",	"rC:CC:F",	"rC:CC:N",	"rC:CC:O",	"rC:CC:S",	"rC:CC=C",
				"rC:CC=Cl",	"rC:CC=N",	"rC:CC=O",	"rC:CC=S",	"rC:CN-C",	"rC:CN-N",
				"rC:CN-S",	"rC:CN.C",	"rC:CO.C",	"rC:CO.P",	"rC:CP-C",	"rC:CS.C",
				"rC:CS.S",	"rC:CS=C",	"rC:ClC:Cl","rC:ClC=C",	"rC:ClC=N",	"rC:FC=C",
				"rC:FC=N",	"rC:IC=C",	"rC:IC=N",	"rC:NC=C",	"rC:NC=N",	"rC:NC=O",
				"rC:NN-C",	"rC:NN.C",	"rC:NO.C",	"rC:NS.C",	"rC:OC:O",	"rC:OC=C",
				"rC:OC=N",	"rC:ON-C",	"rC:ON.C",	"rC:OO.C",	"rC:SC=C",	"rC:SC=N",
				"rC:SN-C",	"rC:SN.C",	"rC:SO.C",	"rC:SS.C",	"rC:SS.S",	"rC=CC=C",
				"rC=CC=N",	"rC=CC=O",	"rC=CN-C",	"rC=CN-N",	"rC=CN-O",	"rC=CN-P",
				"rC=CN-S",	"rC=CN.C",	"rC=CN.N",	"rC=CO.C",	"rC=CO.S",	"rC=CP-C",
				"rC=CS.C",	"rC=NC=N",	"rC=NN-C",	"rC=NN-N",	"rC=NN-P",	"rC=NN-S",
				"rC=NN.C",	"rC=NN.N",	"rC=NO.C",	"rC=NS.C",	"rC=ON-C",	"rC=ON.C",
				"rC=OO.C",	"rC=PP-C",	"rC=SN-C",	"rC=SN-N",	"rC=SN.C",	"rC=SS.C",
				"rN-CN-C",	"rN-CN-P",	"rN-CN.C",	"rN-CN.P",	"rN-CO.C",	"rN-CP-C",
				"rN-CP-Cl",	"rN-CP-F",	"rN-CP-N",	"rN-CP-O",	"rN-CP-S",	"rN-CP=C",
				"rN-CP=N",	"rN-CP=O",	"rN-CS-C",	"rN-CS.C",	"rN-CS.S",	"rN-CS=C",
				"rN-CS=N",	"rN-NP-C",	"rN-NP-N",	"rN-NP-O",	"rN-NP=N",	"rN-OO.C",
				"rN-PN-P",	"rN-PN.P",	"rN-PP-N",	"rN-PP-O",	"rN-PP=N",	"rN-PP=O",
				"rN-SS.S",	"rN.CN.C",	"rN.CP-N",	"rN.CP-O",	"rN.CP=N",	"rN.CS=C",
				"rN.CS=N",	"rN.NP-N",	"rN.NP-O",	"rN.NP=N",	"rN.NP=O",	"rN.PN.P",
				"rN.PP-C",	"rN.PP-F",	"rN.PP-N",	"rN.PP-O",	"rN.PS-N",	"rN.SP-C",
				"rN.SP-N",	"rN:CP-C",	"rN:CP-Cl",	"rN:CP-N",	"rN:CP-O",	"rO.CO.C",
				"rO.CP-C",	"rO.CP-Cl",	"rO.CP-F",	"rO.CP-N",	"rO.CP-O",	"rO.CP-S",
				"rO.CP=C",	"rO.CP=Cl",	"rO.CP=N",	"rO.CP=O",	"rO.CS-C",	"rO.CS=C",
				"rO.CS=O",	"rO.PP-C",	"rO.PP-N",	"rO.PP-O",	"rO.PP=C",	"rO.PP=O",
				"rP-CP-C",	"rP-CP-P",	"rP-CS.C",	"rP-OS.C",	"rP-PP-P",	"rP-SS.C",
				"rP-SS.P",	"rP=CS.C",	"rP=SS.P",	"rS.CS.C",	"rS.CS.S",	"rS.SS.S" };
		return type;
		}

	private static final int[][] getDihedralAngleList() {
		int[][] list = {
				{ 64, 180 },
				{ 62, 180 },
				{ 180 },
				{ 61, 63, 174, 180 },
				{ 45, 51, 57, 80, 163, 178, 180 },
				{ 63, 179 },
				{ 67, 180 },
				{ 66, 176, 180 },
				{ 66, 164 },
				{ 60 },
				{ 71, 84, 87, 120, 153, 178 },
				{ 60, 86, 104, 117 },
				{ 53, 56, 73, 80, 154 },
				{ 0, 66, 88, 173, 180 },
				{ 41, 60, 79, 161, 173 },
				{ 60, 180 },
				{ 60, 180 },
				{ 60, 180 },
				{ 60, 180 },
				{ 64, 180 },
				{ 61, 180 },
				{ 60, 180 },
				{ 61, 180 },
				{ 61, 180 },
				{ 61, 180 },
				{ 62, 180 },
				{ 61, 180 },
				{ 61, 175, 180 },
				{ 62, 180 },
				{ 62, 180 },
				{ 58, 180 },
				{ 62, 178 },
				{ 61, 180 },
				{ 62, 180 },
				{ 63, 132, 180 },
				{ 21, 59, 92, 103, 109, 122, 131, 180 },
				{ 60, 180 },
				{ 0, 18, 20, 49, 69, 98, 104, 117, 133, 135, 153, 172 },
				{ 49, 68, 116, 163, 180 },
				{ 67, 133, 180 },
				{ 61, 64, 177 },
				{ 84, 108, 155 },
				{ 64, 128, 180 },
				{ 1, 6, 14, 35, 37, 57, 61, 82, 106, 115, 127, 135, 149, 156, 159, 176, 180 },
				{ 0, 21, 47, 73, 75, 105, 117, 135, 142, 167 },
				{ 61, 180 },
				{ 63, 115, 180 },
				{ 61, 180 },
				{ 55, 66, 175, 180 },
				{ 61, 180 },
				{ 66, 112, 125, 168 },
				{ 67, 113, 115, 174 },
				{ 63, 107, 130, 180 },
				{ 65, 180 },
				{ 60, 180 },
				{ 0, 66, 91, 95, 105, 123, 145, 178, 180 },
				{ 43, 48, 64, 82, 96, 115, 127, 131, 150, 154, 180 },
				{ 64, 115 },
				{ 0, 54, 57, 118, 179 },
				{ 14, 37, 63, 83, 106, 134, 140, 145, 154, 158, 180 },
				{ 48, 73, 144, 169 },
				{ 4, 14, 33, 55, 85, 88, 98, 126, 151, 178, 180 },
				{ 63, 82, 128, 157, 180 },
				{ 88, 92, 155, 160 },
				{ 67, 111, 123, 174, 180 },
				{ 58, 180 },
				{ 103, 112, 123, 136 },
				{ 98, 114, 141 },
				{ 51, 65, 171, 179 },
				{ 61, 180 },
				{ 60, 179 },
				{ 0, 29, 55, 64, 72, 91, 115, 117, 150, 164, 176 },
				{ 60, 180 },
				{ 55, 172, 175, 178, 180 },
				{ 57, 180 },
				{ 61, 70, 173, 179 },
				{ 56, 68, 170, 180 },
				{ 47, 73, 160, 175, 180 },
				{ 59, 180 },
				{ 64, 172, 179 },
				{ 52, 68, 162, 180 },
				{ 59, 180 },
				{ 54, 62, 69, 173, 180 },
				{ 53, 68, 173, 175 },
				{ 60, 180 },
				{ 0, 11, 34, 39, 45, 52, 79, 106, 129, 135, 140, 169 },
				{ 51, 66, 179 },
				{ 66, 165, 175, 180 },
				{ 63, 180 },
				{ 44, 62, 83, 162, 178 },
				{ 63, 69, 104, 118, 124, 132, 162, 180 },
				{ 52, 82, 85, 173, 179 },
				{ 63, 180 },
				{ 60, 180 },
				{ 57, 180 },
				{ 60, 180 },
				{ 62, 180 },
				{ 62, 180 },
				{ 59, 180 },
				{ 60, 180 },
				{ 58, 177, 180 },
				{ 62, 180 },
				{ 63, 180 },
				{ 67, 179 },
				{ 61, 180 },
				{ 0, 7, 10, 22, 31, 37, 54, 58, 64, 67, 73, 100, 119, 126, 148, 178 },
				{ 47, 58, 63, 85 },
				{ 25, 61, 74, 102, 171, 176, 180 },
				{ 31, 62, 80, 89, 108, 130, 155, 179 },
				{ 24, 34, 62, 74, 85, 139, 145, 151, 178, 180 },
				{ 60, 120 },
				{ 0, 13, 42, 66, 68, 89, 112, 135, 158, 179 },
				{ 61, 180 },
				{ 0, 57, 180 },
				{ 60, 180 },
				{ 11, 43, 77, 110, 131, 162 },
				{ 16, 52, 66, 68, 104, 135, 173, 179 },
				{ 63, 180 },
				{ 60, 180 },
				{ 62, 180 },
				{ 60, 180 },
				{ 62 },
				{ 60, 180 },
				{ 58 },
				{ 60, 180 },
				{ 60, 180 },
				{ 49, 64, 70, 169, 174, 180 },
				{ 59, 180 },
				{ 61, 180 },
				{ 58, 180 },
				{ 60, 180 },
				{ 61, 63, 180 },
				{ 35, 37, 59, 79, 84, 152, 180 },
				{ 58, 180 },
				{ 0, 58, 123, 158, 162, 179 },
				{ 1, 6, 53, 61, 63, 99, 124, 142, 173, 180 },
				{ 12, 17, 45, 57, 60, 108, 131, 166, 180 },
				{ 25, 93, 142 },
				{ 0, 10, 16, 33, 58, 61, 103, 108, 119, 131, 137, 149, 157 },
				{ 0, 2, 60, 118, 121, 123, 126, 180 },
				{ 0, 24, 60, 86, 96, 99, 121, 142, 145, 180 },
				{ 0, 36, 55, 84, 100, 114, 133, 157, 180 },
				{ 0, 52, 68, 119, 171 },
				{ 12, 60, 130, 180 },
				{ 60, 180 },
				{ 22, 60, 66, 99, 141, 180 },
				{ 0, 28, 41, 44, 48, 142, 160, 180 },
				{ 44, 54, 61, 77, 175 },
				{ 26, 44, 61, 146, 180 },
				{ 0, 17, 45, 49, 57, 75, 102, 122, 125, 132, 138, 167, 176, 180 },
				{ 45, 59, 62, 77, 163, 180 },
				{ 39, 43, 59, 133, 163, 179 },
				{ 42, 54, 59, 78, 163, 165, 179 },
				{ 59, 63, 180 },
				{ 29, 64, 87, 111, 117, 133, 141, 153 },
				{ 37, 44, 61, 83, 85, 155, 158, 163, 180 },
				{ 59, 68, 71, 177 },
				{ 41, 62, 75, 82, 161, 180 },
				{ 60, 180 },
				{ 61, 180 },
				{ 60, 180 },
				{ 58, 180 },
				{ 65, 158, 173, 175, 180 },
				{ 59, 180 },
				{ 60, 180 },
				{ 58, 178 },
				{ 57, 165, 180 },
				{ 63, 180 },
				{ 58, 175, 177, 180 },
				{ 60, 92, 180 },
				{ 60, 180 },
				{ 62, 180 },
				{ 46, 72, 165, 179 },
				{ 0, 57, 140, 164, 180 },
				{ 0, 32, 137, 156 },
				{ 15, 44, 180 },
				{ 1, 11, 17, 21, 23, 36, 40, 73, 162, 164, 171 },
				{ 22, 54, 88, 161, 180 },
				{ 0, 64, 66, 103, 126, 137, 144, 152, 180 },
				{ 0, 53, 180 },
				{ 44, 51, 58, 78, 152, 161, 180 },
				{ 4, 29, 31, 35, 68, 85, 88, 111, 138, 153, 180 },
				{ 61, 180 },
				{ 64, 67 },
				{ 64 },
				{ 59, 68, 93, 149, 180 },
				{ 38, 71, 180 },
				{ 55, 60, 73, 156, 180 },
				{ 38, 42, 49, 69, 178 },
				{ 46, 64, 90, 98, 163, 172, 180 },
				{ 37 },
				{ 54, 60, 68, 70 },
				{ 65, 69, 158, 161, 173, 176 },
				{ 62, 180 },
				{ 59, 165 },
				{ 60, 180 },
				{ 64 },
				{ 62, 180 },
				{ 65, 180 },
				{ 71, 180 },
				{ 62, 180 },
				{ 62, 180 },
				{ 65 },
				{ 59, 167, 175, 180 },
				{ 66, 177, 180 },
				{ 60, 171 },
				{ 56, 58, 147, 149, 172, 175, 178 },
				{ 0, 49, 57, 70, 74, 76, 140, 162, 176, 178, 180 },
				{ 32, 43, 56, 170, 176 },
				{ 0, 66, 128 },
				{ 4, 6, 9, 36, 54, 59, 179 },
				{ 0 },
				{ 0, 180 },
				{ 0, 8, 33 },
				{ 0, 23, 56, 117, 120, 126, 131, 161 },
				{ 67 },
				{ 62, 180 },
				{ 67, 85, 96 },
				{ 11, 34, 175, 180 },
				{ 66, 110 },
				{ 67, 70, 76, 180 },
				{ 64 },
				{ 59, 180 },
				{ 64, 179 },
				{ 47, 66, 170, 174, 179 },
				{ 67 },
				{ 34, 60, 62, 70, 151, 177, 180 },
				{ 48, 72, 91, 137, 162, 180 },
				{ 65, 180 },
				{ 57, 167, 175, 180 },
				{ 77, 91, 114, 128, 153, 162, 164 },
				{ 0, 2, 55, 66, 71, 94 },
				{ 64, 69, 116, 175, 180 },
				{ 86, 93, 103, 141, 176, 178 },
				{ 119, 121, 135, 152, 154, 157, 166 },
				{ 1, 32, 39, 52, 78, 107, 110, 118, 150, 153, 171, 179 },
				{ 56, 58, 74, 149, 153, 178, 180 },
				{ 32, 51, 73, 180 },
				{ 60, 180 },
				{ 63, 180 },
				{ 62, 67, 180 },
				{ 60, 75, 180 },
				{ 62, 180 },
				{ 67, 177, 180 },
				{ 56, 90, 104, 107, 128, 143 },
				{ 59, 72, 75, 80, 130, 132, 150, 180 },
				{ 10, 45, 73, 80, 104, 124, 152, 180 },
				{ 27, 73, 76, 135, 171, 179 },
				{ 48, 65, 102, 106, 114, 139, 146, 180 },
				{ 52, 59, 72, 74, 86, 124, 157, 180 },
				{ 66, 73, 76 },
				{ 60, 180 },
				{ 58, 175, 180 },
				{ 3, 36, 45, 55, 87, 93, 128, 148, 178, 180 },
				{ 61, 107, 180 },
				{ 49, 71, 85, 180 },
				{ 52, 69, 71, 161, 179 },
				{ 67, 180 },
				{ 68, 180 },
				{ 15, 66, 76, 85, 94, 108 },
				{ 180 },
				{ 0, 6, 67, 70, 86, 91, 96, 158, 180 },
				{ 64, 69, 84, 98, 101, 137, 166 },
				{ 180 },
				{ 65, 180 },
				{ 65, 180 },
				{ 65, 180 },
				{ 180 },
				{ 64, 180 },
				{ 66, 72, 169 },
				{ 82 },
				{ 80, 82, 97, 179 },
				{ 54, 61, 81, 84 },
				{ 58, 62, 78, 85, 174, 180 },
				{ 180 },
				{ 95, 124, 126, 180 },
				{ 180 },
				{ 75, 77, 94, 125, 137, 145, 165, 177 },
				{ 65, 180 },
				{ 83, 180 },
				{ 70, 176, 180 },
				{ 102, 130 },
				{ 93, 139, 149 },
				{ 180 },
				{ 78, 83, 91, 93, 97, 180 },
				{ 99, 125, 127, 137, 140, 165, 180 },
				{ 97, 119, 151, 157, 171, 179 },
				{ 89 },
				{ 28, 63, 98, 101, 125, 139, 170, 172, 180 },
				{ 180 },
				{ 77, 178, 180 },
				{ 62, 76, 166, 169, 171, 175, 180 },
				{ 135, 174, 180 },
				{ 152, 178 },
				{ 62, 180 },
				{ 60, 63, 180 },
				{ 62, 180 },
				{ 62, 176, 180 },
				{ 70, 180 },
				{ 60, 179 },
				{ 54, 68, 180 },
				{ 0, 88, 90, 176, 180 },
				{ 52, 76, 78, 81, 175, 180 },
				{ 66, 153 },
				{ 69, 180 },
				{ 79, 101, 153, 170, 180 },
				{ 65, 88 },
				{ 66, 180 },
				{ 66, 72, 180 },
				{ 58, 177, 180 },
				{ 64, 180 },
				{ 63, 180 },
				{ 66 },
				{ 67, 71, 88, 180 },
				{ 180 },
				{ 0, 2, 7, 12, 180 },
				{ 3, 175, 177, 179 },
				{ 61, 180 },
				{ 56, 180 },
				{ 0, 17, 39, 62, 77, 141, 157 },
				{ 84 },
				{ 60, 65, 174 },
				{ 64, 180 },
				{ 63, 180 },
				{ 180 },
				{ 59, 180 },
				{ 62, 75, 81, 100, 180 },
				{ 180 },
				{ 0, 22, 173 },
				{ 0, 180 },
				{ 69, 84, 110, 112, 171 },
				{ 74, 118 },
				{ 106, 117, 119, 127, 135 },
				{ 65, 79, 81 },
				{ 77, 174, 176 },
				{ 68 },
				{ 61, 87, 163, 180 },
				{ 61, 74, 79, 147, 152, 173, 179 },
				{ 49, 53, 70, 74, 180 },
				{ 37, 43, 45, 54, 59, 74, 77, 95, 180 },
				{ 69 },
				{ 58, 80, 162, 180 },
				{ 66, 180 },
				{ 69, 180 },
				{ 0, 54, 68, 71, 82, 85, 180 },
				{ 180 },
				{ 0, 35, 62, 69 },
				{ 180 },
				{ 0, 175 },
				{ 180 },
				{ 56, 76, 96, 101 },
				{ 52, 56, 76, 100, 107, 157 },
				{ 89 },
				{ 70, 92 },
				{ 75 },
				{ 53, 63, 77, 178 },
				{ 56, 58, 64, 180 },
				{ 180 },
				{ 88 },
				{ 61, 69, 99, 111, 117, 119, 158, 180 },
				{ 0, 28, 50, 72, 88, 90, 98, 106, 159 },
				{ 73, 88, 93, 99, 163, 166, 170, 180 },
				{ 180 },
				{ 39, 100, 152, 172, 180 },
				{ 80, 179 },
				{ 180 },
				{ 77, 102, 180 },
				{ 76, 175 },
				{ 71, 73, 79, 82, 91, 93, 97, 115, 144, 147, 159, 180 },
				{ 85, 179 },
				{ 80, 97, 122, 124, 129 },
				{ 80, 107, 126 },
				{ 68, 92, 173, 180 },
				{ 0, 54, 58, 180 },
				{ 0, 68, 89, 92, 107, 153, 157, 170 },
				{ 49, 52, 58, 60, 96, 107, 173, 180 },
				{ 0 },
				{ 0 },
				{ 0, 180 },
				{ 0 },
				{ 0, 21, 64, 180 },
				{ 0, 59, 180 },
				{ 0, 180 },
				{ 0, 180 },
				{ 180 },
				{ 54, 57, 61, 71, 96, 106, 132, 152, 158, 180 },
				{ 75, 86, 96, 117 },
				{ 0, 17, 22, 35, 42, 54, 61, 71, 103, 106, 121, 128, 137, 180 },
				{ 9, 42, 71, 102, 148 },
				{ 47, 57 },
				{ 38, 45, 53, 55, 57, 96, 119, 148 },
				{ 34, 54, 75, 93, 103, 138 },
				{ 0, 24, 41, 66, 87, 114, 156 },
				{ 2, 45, 62, 86, 180 },
				{ 65, 83, 136 },
				{ 70 },
				{ 1, 180 },
				{ 8, 15, 21, 64, 75, 126, 159, 180 },
				{ 0, 42, 180 },
				{ 69, 84, 88, 180 },
				{ 0, 11, 81, 98, 124, 126, 167, 180 },
				{ 0, 26, 180 },
				{ 0, 29, 153, 155, 180 },
				{ 0, 34, 59, 66, 120, 148, 176, 180 },
				{ 0, 180 },
				{ 2, 180 },
				{ 0, 74, 180 },
				{ 52, 105, 108, 142 },
				{ 0, 44, 82, 176 },
				{ 69, 73, 95 },
				{ 180 },
				{ 33, 151, 180 },
				{ 0, 180 },
				{ 11, 49, 84, 109, 118, 152, 166, 168 },
				{ 0, 54, 180 },
				{ 0, 71 },
				{ 46, 102, 142, 180 },
				{ 1, 47, 101, 118, 121, 180 },
				{ 0, 26, 79, 81, 85, 91, 113, 142, 163, 171, 179 },
				{ 0, 24, 180 },
				{ 12, 25, 34, 168, 177, 180 },
				{ 0, 180 },
				{ 0 },
				{ 0, 22, 64, 85, 87, 117, 155, 180 },
				{ 0 },
				{ 81, 83, 85, 87 },
				{ 1, 22, 30, 54, 65 },
				{ 61, 102 },
				{ 73 },
				{ 1, 180 },
				{ 0, 103, 180 },
				{ 0, 180 },
				{ 180 },
				{ 0, 180 },
				{ 0, 179 },
				{ 1, 180 },
				{ 26 },
				{ 180 },
				{ 180 },
				{ 180 },
				{ 180 },
				{ 175, 180 },
				{ 180 },
				{ 180 },
				{ 180 },
				{ 180 },
				{ 38, 53, 70, 97, 165, 180 },
				{ 37, 61, 69, 72, 75, 99, 110, 121, 130, 133, 141, 144, 171, 174, 177 },
				{ 41, 48, 57, 62, 66, 70, 113, 157, 162, 167, 176, 178 },
				{ 18, 44, 46, 65, 160, 162, 180 },
				{ 33, 73, 180 },
				{ 180 },
				{ 180 },
				{ 176, 180 },
				{ 59, 82, 119, 180 },
				{ 0, 180 },
				{ 180 },
				{ 1, 3, 7, 180 },
				{ 80, 162, 180 },
				{ 0, 180 },
				{ 0, 180 },
				{ 15, 180 },
				{ 29, 167 },
				{ 0, 180 },
				{ 0, 180 },
				{ 179 },
				{ 180 },
				{ 180 },
				{ 0, 178 },
				{ 0, 7, 95, 98, 119, 136, 140, 145 },
				{ 37, 51, 70, 100, 104, 109, 113, 128, 157, 180 },
				{ 180 },
				{ 174, 180 },
				{ 180 },
				{ 0, 180 },
				{ 0, 180 },
				{ 4, 15, 179 },
				{ 0, 4, 12, 19, 175, 180 },
				{ 180 },
				{ 180 },
				{ 180 },
				{ 180 },
				{ 0, 23, 25, 155, 162, 164, 180 },
				{ 180 },
				{ 40, 71, 126, 138, 140, 142, 144 },
				{ 0, 119, 180 },
				{ 0, 32, 164, 167, 180 },
				{ 0, 180 },
				{ 0, 180 },
				{ 0, 180 },
				{ 180 },
				{ 0, 14, 17, 38, 60, 79, 98, 121, 142, 171, 180 },
				{ 0, 8, 63, 120, 180 },
				{ 180 },
				{ 0 },
				{ 91 },
				{ 66, 86, 93, 114, 180 },
				{ 63, 87, 91, 115 },
				{ 61, 79, 81, 116 },
				{ 72, 91, 96, 106 },
				{ 66, 80, 110, 180 },
				{ 0, 180 },
				{ 91, 95, 97 },
				{ 112, 118, 120 },
				{ 54, 89, 126, 142, 160, 180 },
				{ 48, 71 },
				{ 16, 23, 32, 43, 77, 79, 96, 117, 134, 156, 175, 180 },
				{ 49, 127, 129 },
				{ 53, 77, 112, 132, 135, 138, 165 },
				{ 52, 123, 133, 156 },
				{ 13, 17, 23, 43, 75, 116, 133, 139, 160 },
				{ 0, 30, 50, 75, 130, 180 },
				{ 38, 53, 75, 167, 180 },
				{ 46, 115, 135, 166 },
				{ 49, 120, 148, 167 },
				{ 58, 80, 165 },
				{ 19, 53, 72, 86, 93, 117, 174 },
				{ 71, 113, 128, 141 },
				{ 57, 89, 134, 157, 162, 180 },
				{ 52, 124, 138 },
				{ 64, 140, 172, 180 },
				{ 54, 98, 158, 180 },
				{ 90, 96, 102 },
				{ 83 },
				{ 73, 89 },
				{ 72 },
				{ 61, 72, 95, 180 },
				{ 61, 64, 92, 180 },
				{ 51, 128 },
				{ 54 },
				{ 46 },
				{ 52 },
				{ 54 },
				{ 62, 74 },
				{ 57, 80, 169 },
				{ 53, 63, 68, 82 },
				{ 0, 3, 16, 25, 172, 174, 176, 180 },
				{ 50, 126 },
				{ 118, 142 },
				{ 0, 6, 26, 44, 56, 62, 117, 123, 129, 145, 180 },
				{ 12, 60, 74, 78, 82, 103, 112, 129, 159 },
				{ 35, 51, 61, 69, 83, 90, 124, 127, 135, 153, 156, 165 },
				{ 38, 54, 75, 97, 122 },
				{ 99 },
				{ 15, 54, 104, 125, 138, 141, 145, 148, 156, 180 },
				{ 83, 96 },
				{ 88 },
				{ 94 },
				{ 82 },
				{ 0, 76, 98, 108, 118, 180 },
				{ 2, 180 },
				{ 83, 132, 136, 166, 178, 180 },
				{ 59, 69, 110, 148, 161, 180 },
				{ 54, 78, 156, 180 },
				{ 52, 139, 142, 180 },
				{ 54, 179 },
				{ 54, 72, 171, 178 },
				{ 59 },
				{ 63, 180 },
				{ 53, 88, 180 },
				{ 59, 120, 134, 166, 180 },
				{ 50, 137 },
				{ 180 },
				{ 63 },
				{ 61 },
				{ 0, 180 },
				{ 56, 59, 178, 180 },
				{ 0, 50, 75, 173, 180 },
				{ 56 },
				{ 59 },
				{ 4, 39, 44, 57, 80, 127, 149, 165 },
				{ 45, 47, 51, 54, 62, 105, 153 },
				{ 53, 111 },
				{ 68, 180 },
				{ 40, 69, 93, 115, 133, 146, 148, 157 },
				{ 77 },
				{ 14, 44, 48, 68, 95, 108, 112, 153 },
				{ 0, 180 },
				{ 88, 116, 136, 157, 180 },
				{ 71, 90, 94, 101, 104, 180 },
				{ 0, 28, 60, 92, 140, 161, 180 },
				{ 39, 47, 52 },
				{ 46, 85, 175 },
				{ 70, 86, 180 },
				{ 72 },
				{ 70, 94, 96, 104, 180 },
				{ 180 },
				{ 64, 74, 179 },
				{ 67, 180 },
				{ 72 },
				{ 25, 100, 130, 133, 143 },
				{ 73 },
				{ 68, 174, 180 },
				{ 65, 71, 180 },
				{ 68 },
				{ 82, 97, 102, 124, 147, 151, 165 },
				{ 0, 21, 39, 83, 98, 139, 158 },
				{ 3, 14, 17, 46, 62, 64, 80, 100, 127, 150, 155, 164, 171, 180 },
				{ 30, 37, 57, 59, 64, 71, 73, 75, 99, 147, 149, 179 },
				{ 0, 72, 180 },
				{ 0, 7, 71, 180 },
				{ 10, 30, 66, 78, 105, 112, 123, 168, 171, 177 },
				{ 68, 180 },
				{ 53, 71, 88, 123, 180 },
				{ 73, 76, 145, 150, 159 },
				{ 55, 58, 101, 147 },
				{ 31, 68, 93, 95, 148, 180 },
				{ 0, 83, 113, 165 },
				{ 46, 84, 86, 118, 180 },
				{ 20, 82, 84, 86, 90, 168 },
				{ 53, 69, 71, 77, 80, 180 },
				{ 129 },
				{ 30, 32, 51, 75 },
				{ 27, 93, 180 },
				{ 48, 90, 173, 180 },
				{ 96, 113, 174, 180 },
				{ 70, 180 },
				{ 49, 139, 141, 180 },
				{ 50, 82 },
				{ 52, 180 },
				{ 87, 108 },
				{ 87 },
				{ 72 },
				{ 89 },
				{ 93 },
				{ 79, 90, 93, 97, 110, 180 },
				{ 98 },
				{ 77, 90 },
				{ 58, 148, 165 },
				{ 64, 180 },
				{ 66 },
				{ 66, 180 },
				{ 62, 180 },
				{ 180 },
				{ 180 },
				{ 66, 174, 180 },
				{ 77 },
				{ 92, 124, 180 },
				{ 85, 95, 98, 143, 146, 159 },
				{ 57, 180 },
				{ 64, 180 },
				{ 66, 180 },
				{ 69, 71, 180 },
				{ 59, 180 },
				{ 60, 180 },
				{ 60, 83, 180 },
				{ 61, 180 },
				{ 57, 180 },
				{ 58, 180 },
				{ 59, 180 },
				{ 57, 180 },
				{ 64, 180 },
				{ 59, 122, 180 },
				{ 0, 51, 74, 123, 167 },
				{ 58, 122, 180 },
				{ 57, 122, 180 },
				{ 33, 48, 59, 69, 91, 172, 180 },
				{ 58, 179 },
				{ 115, 133 },
				{ 32, 42, 55, 59, 70, 74, 85, 107, 120, 134, 150, 157, 162, 179 },
				{ 0, 56, 180 },
				{ 0, 16, 66, 87, 118, 150, 180 },
				{ 0, 25, 56, 84, 96, 100, 124, 155, 180 },
				{ 0, 20, 46, 68, 80, 87, 115, 149, 168 },
				{ 60, 180 },
				{ 58, 180 },
				{ 52, 67, 169 },
				{ 47, 74, 164 },
				{ 38, 44, 62, 71, 87, 96, 100, 137, 150, 168, 177, 180 },
				{ 56, 180 },
				{ 57, 63, 180 },
				{ 46, 48, 53, 58, 61, 171, 180 },
				{ 57, 64, 71, 73, 180 },
				{ 24, 50, 72, 94, 166, 168, 180 },
				{ 68, 73, 92, 148, 161, 180 },
				{ 27, 38, 84, 98, 156 },
				{ 60, 180 },
				{ 54, 66, 172, 178 },
				{ 61, 180 },
				{ 57, 180 },
				{ 64, 172, 180 },
				{ 56, 58, 80, 87, 89, 175 },
				{ 36, 39, 52, 71, 85, 104, 168 },
				{ 41, 60, 90, 162 },
				{ 44, 62, 68, 71, 164, 167, 180 },
				{ 56, 172 },
				{ 44, 47, 68, 92, 157, 159, 165, 180 },
				{ 62, 171, 179 },
				{ 56 },
				{ 62, 180 },
				{ 70, 170 },
				{ 60, 180 },
				{ 45, 64, 75, 77, 162, 179 },
				{ 47, 69, 71, 156, 158, 175, 180 },
				{ 62, 179 },
				{ 57 },
				{ 66, 180 },
				{ 61, 180 },
				{ 63, 114, 175 },
				{ 70, 180 },
				{ 179 },
				{ 71, 180 },
				{ 71, 180 },
				{ 0, 60, 87 },
				{ 73, 105, 139, 141, 155, 158, 180 },
				{ 76, 83, 85, 88, 93, 95, 120, 153, 180 },
				{ 70, 120, 180 },
				{ 70, 83, 180 },
				{ 66, 180 },
				{ 67, 173 },
				{ 51, 166 },
				{ 76, 167 },
				{ 62, 66, 172 },
				{ 65, 180 },
				{ 180 },
				{ 53, 169 },
				{ 58, 171 },
				{ 0, 42, 50, 59, 153, 180 },
				{ 0, 36, 44, 46, 55 },
				{ 121, 180 },
				{ 97, 146 },
				{ 48, 73, 168 },
				{ 69, 173, 180 },
				{ 69, 173, 180 },
				{ 68, 180 },
				{ 56, 170, 178 },
				{ 66, 158, 180 },
				{ 180 },
				{ 0, 57, 180 },
				{ 61, 180 },
				{ 62, 178 },
				{ 55, 180 },
				{ 56, 71, 180 },
				{ 62, 180 },
				{ 60, 180 },
				{ 62, 82 },
				{ 60, 90, 129, 161 },
				{ 60, 84 },
				{ 30, 57, 68, 88 },
				{ 32, 49, 66, 85, 157, 169, 171, 178 },
				{ 53, 87, 98, 156, 176 },
				{ 2, 18, 70, 168 },
				{ 0, 180 },
				{ 59, 180 },
				{ 53, 63, 73, 76, 101, 121, 156, 161, 164 },
				{ 71, 180 },
				{ 65, 102, 125, 127, 140 },
				{ 52, 179 },
				{ 11, 52 },
				{ 59, 180 },
				{ 49, 68, 93, 166, 170 },
				{ 54 },
				{ 50 },
				{ 63, 180 },
				{ 160, 180 },
				{ 62, 180 },
				{ 65, 180 },
				{ 62, 180 },
				{ 66, 180 },
				{ 61, 178 },
				{ 58 },
				{ 25, 58, 159, 180 },
				{ 48, 58, 80 },
				{ 59 },
				{ 60, 62, 82, 87, 167, 170, 180 },
				{ 37, 47, 50, 71, 92, 180 },
				{ 0, 44, 58, 156, 180 },
				{ 60, 117, 164, 171, 173, 176, 180 },
				{ 36, 80, 100, 154, 157 },
				{ 5, 40, 150, 157, 178 },
				{ 64, 100, 180 },
				{ 71, 143 },
				{ 39, 42, 59, 167, 172, 175 },
				{ 78, 106, 111, 138 },
				{ 58, 78, 89, 93, 151 },
				{ 61, 180 },
				{ 65, 67, 70, 80, 180 },
				{ 68 },
				{ 19, 37, 65, 76, 172, 180 },
				{ 30, 55, 58, 65, 157, 165, 169, 180 },
				{ 46, 71, 82, 86, 152, 175, 180 },
				{ 48, 82, 150 },
				{ 61, 180 },
				{ 60, 180 },
				{ 180 },
				{ 74, 91, 99, 108, 147, 180 },
				{ 72, 180 },
				{ 63, 180 },
				{ 42, 60, 70, 180 },
				{ 54, 164, 166 },
				{ 79, 180 },
				{ 65, 177, 180 },
				{ 68, 180 },
				{ 48, 60, 68, 71, 82, 174 },
				{ 72, 177, 180 },
				{ 62 },
				{ 56, 75, 93, 148, 168 },
				{ 47, 71, 84, 86, 110, 166, 168, 178 },
				{ 47, 74, 107 },
				{ 66, 101 },
				{ 48, 51, 65 },
				{ 70, 180 },
				{ 62 },
				{ 36, 71 },
				{ 60 },
				{ 55 },
				{ 55 },
				{ 57 },
				{ 61 },
				{ 65 },
				{ 174, 180 },
				{ 52, 167 },
				{ 160 },
				{ 161, 178 },
				{ 170 },
				{ 167 },
				{ 34, 49 },
				{ 30, 66 },
				{ 3, 23, 41, 67 },
				{ 58, 180 },
				{ 58, 81, 173, 176, 180 },
				{ 61, 180 },
				{ 53, 131, 157 },
				{ 163 },
				{ 57 },
				{ 55 },
				{ 49 },
				{ 57, 163 },
				{ 59 },
				{ 58 },
				{ 62 },
				{ 55 },
				{ 62, 94 },
				{ 54, 168 },
				{ 22, 62, 115, 162 },
				{ 46 },
				{ 54, 168 },
				{ 62, 64, 162 },
				{ 61, 168 },
				{ 51, 158, 180 },
				{ 56 },
				{ 61, 82 },
				{ 58, 61, 81 },
				{ 56 },
				{ 49 },
				{ 0, 58 },
				{ 58 },
				{ 61 },
				{ 18, 53, 174, 180 },
				{ 0, 2, 4, 31, 40, 47, 54, 66, 173, 180 },
				{ 0, 24, 70 },
				{ 59 },
				{ 64, 95, 114 },
				{ 180 },
				{ 67, 97, 123, 164 },
				{ 19, 39, 46, 54 },
				{ 57 },
				{ 49 },
				{ 45, 59 },
				{ 59 },
				{ 62, 66 },
				{ 50, 157, 168, 180 },
				{ 25, 40, 43, 46, 48 },
				{ 62 },
				{ 66, 115 },
				{ 63 },
				{ 48 },
				{ 55, 57, 59, 155 },
				{ 0, 60 },
				{ 61 },
				{ 78, 93 },
				{ 49, 180 },
				{ 0, 47, 50, 52, 114, 116, 119, 152 },
				{ 32, 66, 120, 152 },
				{ 63, 152 },
				{ 67 },
				{ 68 },
				{ 161 },
				{ 160 },
				{ 65, 69, 82, 135 },
				{ 43, 55 },
				{ 62, 65, 70 },
				{ 66 },
				{ 67 },
				{ 180 },
				{ 180 },
				{ 0, 180 },
				{ 0, 180 },
				{ 113, 180 },
				{ 180 },
				{ 1, 180 },
				{ 1, 180 },
				{ 8, 11, 180 },
				{ 180 },
				{ 0, 155, 180 },
				{ 180 },
				{ 0, 180 },
				{ 180 },
				{ 0, 180 },
				{ 0, 44, 146, 149, 153, 180 },
				{ 140, 153 },
				{ 0, 180 },
				{ 180 },
				{ 132, 134, 136, 161, 168, 176, 180 },
				{ 35, 43, 59, 73, 77, 80, 125, 130, 134, 136, 154, 167, 180 },
				{ 180 },
				{ 111, 132, 143 },
				{ 180 },
				{ 0, 41 },
				{ 180 },
				{ 180 },
				{ 180 },
				{ 180 },
				{ 180 },
				{ 0, 180 },
				{ 180 },
				{ 180 },
				{ 0, 3, 180 },
				{ 0, 180 },
				{ 0, 180 },
				{ 180 },
				{ 0, 154, 156, 180 },
				{ 0 },
				{ 180 },
				{ 180 },
				{ 0, 180 },
				{ 180 },
				{ 180 },
				{ 180 },
				{ 180 },
				{ 1, 18, 22, 34, 42, 135, 159, 180 },
				{ 166, 180 },
				{ 167 },
				{ 137, 139, 169 },
				{ 25, 43, 109, 144 },
				{ 0 },
				{ 0, 180 },
				{ 0, 9, 180 },
				{ 0, 180 },
				{ 0, 180 },
				{ 180 },
				{ 1 },
				{ 0, 21, 180 },
				{ 0 },
				{ 0 },
				{ 0 },
				{ 25, 33, 48, 50, 158, 170 },
				{ 0, 6, 128, 180 },
				{ 0, 180 },
				{ 0, 180 },
				{ 0, 180 },
				{ 0, 180 },
				{ 0, 5 },
				{ 150, 180 },
				{ 0 },
				{ 0 },
				{ 0, 180 },
				{ 1, 180 },
				{ 0, 180 },
				{ 0, 180 },
				{ 0 },
				{ 11, 44, 51, 59, 78 },
				{ 0, 180 },
				{ 0, 180 },
				{ 0, 180 },
				{ 0, 179 },
				{ 0, 35, 62, 82, 102, 104, 110, 113, 115, 125, 157, 180 },
				{ 51, 62, 93, 95, 110, 134, 156 },
				{ 0, 24, 37, 57, 82, 87, 92, 96, 102, 128, 130, 137, 140, 159, 169, 180 },
				{ 48, 97, 119, 125, 133 },
				{ 0, 71, 120, 174 },
				{ 12, 24, 30, 44, 65, 69, 76, 78, 81, 101, 105, 142, 144, 164, 180 },
				{ 65, 79, 81, 94, 118 },
				{ 69, 99, 124 },
				{ 31, 88, 104, 107, 133, 164 },
				{ 44, 62, 67, 87, 126, 160 },
				{ 73, 76, 78, 140 },
				{ 78, 98, 105, 139, 143 },
				{ 27, 29, 47, 79, 82, 95, 102, 104, 110, 127, 154, 162, 165, 180 },
				{ 15, 40, 45, 61, 89, 99, 109, 128, 142, 147, 150, 162 },
				{ 29, 37, 39, 67, 72, 79, 98, 157, 176, 180 },
				{ 61, 67, 72, 88, 98, 102 },
				{ 70, 83, 106 },
				{ 55, 80, 153 },
				{ 22, 44, 90, 160, 177, 180 },
				{ 63, 149 },
				{ 47 },
				{ 61, 132, 153, 180 },
				{ 52 },
				{ 174, 177 },
				{ 56, 72 },
				{ 46, 67 },
				{ 54 },
				{ 51, 70, 74 },
				{ 27, 55, 180 },
				{ 51, 83, 138, 145 },
				{ 67 },
				{ 0, 23, 41 },
				{ 9, 33, 110 },
				{ 37, 79, 126, 128 },
				{ 16, 37, 81, 151 },
				{ 52, 54 },
				{ 11, 13, 17, 31, 49 },
				{ 40 },
				{ 63, 69, 74, 146 },
				{ 30, 33, 40, 44 },
				{ 63, 146 },
				{ 47, 55, 63 },
				{ 123 },
				{ 128 },
				{ 0 },
				{ 124 },
				{ 0, 3, 13, 15, 25, 29, 75 },
				{ 114, 124, 127, 133 },
				{ 4, 122, 129, 131 },
				{ 61, 64, 67, 70, 80, 91, 101, 111, 119 },
				{ 61, 119 },
				{ 0, 9, 28, 82, 122, 152, 180 },
				{ 61, 117 },
				{ 0, 44, 70 },
				{ 45, 57, 78, 123, 165 },
				{ 53, 64, 122, 125, 141, 145, 148 },
				{ 69, 84, 180 },
				{ 45, 58, 63, 160 },
				{ 49 },
				{ 67, 164 },
				{ 70, 159 },
				{ 68, 102 },
				{ 38, 40, 70, 159 },
				{ 43, 65 },
				{ 65, 170, 180 },
				{ 61 },
				{ 59 },
				{ 33, 54, 76, 101, 120, 146 },
				{ 55, 151, 170 },
				{ 50 },
				{ 22, 46, 86, 106, 153, 163 },
				{ 0, 14, 23, 46, 159 },
				{ 78, 156, 180 },
				{ 180 },
				{ 53, 64, 72, 166 },
				{ 55, 72, 85, 100, 170, 180 },
				{ 84 },
				{ 10, 54, 62, 64 },
				{ 59, 180 },
				{ 55, 60, 180 },
				{ 65 },
				{ 12, 59, 82, 84 },
				{ 68, 91 },
				{ 73 } };
	return list;	
	}
}